﻿using Basic.FormRemoteModel.Page;
using Basic.FormRemoteModel.Page.Model;
using Basic.FormService.Interface;
using WeDonekRpc.Client;
using WeDonekRpc.Client.Interface;

namespace Basic.FormService.RpcEvent
{
    internal class CustomPageEvent : IRpcApiService
    {
        private readonly ICustomPageService _Service;

        public CustomPageEvent ( ICustomPageService service )
        {
            this._Service = service;
        }
        public PageAppPower GetPagePower ( GetPagePower obj )
        {
            return this._Service.GetPower(obj.Id);
        }
        public void AddPagePower ( AddPagePower obj )
        {
            this._Service.AddPower(obj.Id, obj.Power);
        }
        public void EnableCustomPage ( EnableCustomPage obj )
        {
            this._Service.Enable(obj.Id);
        }
        public void DisableCustomPage ( DisableCustomPage obj )
        {
            this._Service.Disable(obj.Id);
        }
        public long AddCustomPage ( AddCustomPage data )
        {
            return this._Service.Add(data.Datum);
        }
        public PagingResult<PageDatum> QueryCustomPage ( QueryCustomPage obj )
        {
            return this._Service.Query(obj.Query, obj.ToBasicPage());
        }

        public PageDatum GetCustomPage ( GetCustomPage obj )
        {
            return this._Service.Get(obj.Id);
        }
        public void DeleteCustomPage ( DeleteCustomPage obj )
        {
            this._Service.Delete(obj.Id);
        }
        public bool SetCustomPage ( SetCustomPage set )
        {
            return this._Service.Set(set.Id, set.Datum);
        }
    }
}
